home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Input / IFOParser / toast.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-06  |  2.2 KB  |  85 lines

  1.  
  2. /*
  3.  * Copyright (C) 1998,1999  Thomas Mirlacher
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  * 
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  * 
  19.  * The author may be reached as dent@cosy.sbg.ac.at, or
  20.  * Thomas Mirlacher, Jakob-Haringerstr. 2, A-5020 Salzburg,
  21.  * Austria
  22.  *
  23.  *------------------------------------------------------------
  24.  *
  25.  */
  26.  
  27.  
  28.  
  29. #include <stdio.h>
  30.  
  31. #include <sys/types.h>
  32. //#include <unistd.h>
  33. #include "ifo.h"
  34.  
  35. #include "misc.h"
  36. #include "decode.h"
  37.  
  38.  
  39. typedef struct {
  40.     u_char    playback_type    : 8;
  41.     u_char    num_angles    : 8;
  42.         u_short    num_ptt        : 16;
  43.     u_short    parental_control: 16;
  44.     u_char    title_set_num    : 8;
  45.     u_char    vts_ttn        : 8;    
  46.         u_int    offset        : 32;
  47. } ifo_toast_t;
  48.  
  49. /**
  50.  *
  51.  */
  52.  
  53. void ifoPrintToast (u_char *ptr)
  54. {
  55.     ifo_hdr_t *hdr = (ifo_hdr_t *) ptr;
  56.     ifo_toast_t *toast;
  57.     int i;
  58.  
  59.     if (!ptr)
  60.         return;
  61.  
  62.     printf ("\nTOAST TABLE\n");
  63.     printf ("---\n");
  64.     printf ("number of maps: %d\n", bswap_16 (hdr->num));    
  65.     printf ("length of table: %d\n", bswap_32 (hdr->len));    
  66.  
  67.     ptr = (unsigned char *)hdr + 1;
  68.     toast = (ifo_toast_t *) ptr;
  69.  
  70.     for (i=0; i<bswap_16 (hdr->num); i++) {
  71.         printf ("%d:\n", i);
  72.         printf ("\tplayback_type:    0x%x\n", toast->playback_type);
  73.         printf ("\tnum_angles:       0x%x\n", toast->num_angles);
  74.         printf ("\tnum_ptt:          0x%x\n", bswap_16 (toast->num_ptt));
  75.  
  76.         printf ("\tparental_control: 0x%x\n", bswap_16 (toast->parental_control));
  77.         printf ("\ttitle_set_num:    0x%x\n", toast->title_set_num);
  78.         printf ("\tvts_ttn:          0x%x\n", toast->vts_ttn);
  79.  
  80.         printf ("\toffset:           0x%x\n", bswap_32 (toast->offset));
  81.  
  82.         toast++;
  83.     }
  84. }    
  85.